package 剑指offer.Month7_07.day12;

public class 调整数组顺序使奇数位位于偶数位前面 {
    public int[] reOrderArray (int[] array) {
        // write code here
        int i = 0;
        for (int j = 0; j < array.length; j++) {
            if(array[j] % 2 != 0){
                int tmp = array[j];
                for(int k = j - 1;k > i;k--){
                    array[k + 1] = array[k];
                }
                array[i++] = tmp;
            }
        }
        return array;
    }
}
